/**
 * Created with CLion.
 * Description: 
 * User: loong
 * Date: 2025/4/26
 * Time: 23:33
 */

#ifndef OBJECTAFFILIATE_H
#define OBJECTAFFILIATE_H

#include "ObjectScreen.h"
enum class Anchor
{
    NONE,
    TOP_LEFT,
    TOP_CENTER,
    TOP_RIGHT,
    CENTER_LEFT,
    CENTER,
    CENTER_RIGHT,
    BOTTOM_LEFT,
    BOTTOM_CENTER,
    BOTTOM_RIGHT,
};

class ObjectAffiliate : public Object
{
public:
    ObjectScreen * GetParent() const { return parent_; }
    void           SetParent(ObjectScreen * _parent) { parent_ = _parent; }

    glm::vec2 GetOffset() const { return offset_; }
    void      SetOffset(const glm::vec2 & _offset) { offset_ = _offset; }

    glm::vec2 GetSize() const { return size_; }
    void      SetSize(const glm::vec2 & _size);

    void SetScale(float _scale);

    Anchor ObjectAffiliate::GetAnchor() const { return anchor_; }
    void   ObjectAffiliate::SetAnchor(Anchor _anchor) { anchor_ = _anchor; }

    void SetOffsetByAnchor(Anchor _anchor);
protected:
    ObjectScreen * parent_ {nullptr};

    glm::vec2 offset_ {0};
    glm::vec2 size_ {0};

    Anchor anchor_ {Anchor::CENTER};
};

#endif//OBJECTAFFILIATE_H
